package arithmetic;

import java.util.LinkedList;

public class DefineQueue<E> implements Cloneable{

	LinkedList<E> queue=new LinkedList<E>();

	public DefineQueue() {
		
	}
	public void add(E e) {
		queue.addLast(e);
	}
	
	/*private E peek() {
		
		if(!queue.isEmpty()) {
			return queue.getFirst();
		}
		return null;
		
	}*/
	public E poll() {
		if(!queue.isEmpty()) {
			E getE=queue.getFirst();
			queue.removeFirst();
			return getE;
		}
		return null;
		
		
	}
	public boolean isEmpty() {
		return queue.isEmpty();
	}
	
	
	
	
	

	@SuppressWarnings("unchecked")
	@Override
	public DefineQueue<E> clone() throws CloneNotSupportedException {
		// TODO Auto-generated method stub
		DefineQueue<E> DQ=(DefineQueue<E>) super.clone();
		DQ.queue=(LinkedList<E>) queue.clone();
		return DQ;
	}
	@Override
	public String toString() {
		return queue+"";
	}
	public void setQueue(LinkedList<E> queue) {
		this.queue = queue;
	}
	
	
}
